package com.dtsmoll.installapk;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

public class InstallApkUtils {

    static OnInstallApkCallback callback;
    // FileProvider
    static String authority;
    // 安装包地址
    static String apkPath;

    /**
     * 7.0适配
     */
    public static void setAuthority(String authority) {
        InstallApkUtils.authority = authority;
    }

    /**
     * 设置安装包地址
     */
    public static void setApkPath(String apkPath) {
        InstallApkUtils.apkPath = apkPath;
    }

    /**
     * 安装apk
     */
    public static void installApk(Context context, OnInstallApkCallback callback) {
        InstallApkUtils.callback = callback;
        context.startActivity(new Intent(context, InstallApkActivity.class));
    }

    public interface OnInstallApkCallback {
        void onComplete(boolean complete);
    }
}
